// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
import './mock'

import bootstrap from './core/bootstrap'
import './core/lazy_use'
import './permission' // permission control
import './utils/filter' // global filter
import { Dialog } from '@/components'
import { hasBtnPermission } from './utils/permissions' // button permission
import { sysApplication } from './utils/applocation'
import Element from 'element-ui'
import dict from './components/Dict'  // 数据字典
import elTableInfiniteScroll from 'el-table-infinite-scroll' // el-table无限滚动组件
import AFTableColumn from 'af-table-column'                  // el-table列宽自适应组件
import UmyUi from 'umy-ui'

import bus from './utils/bus'
import './components/global.less'
import 'element-ui/lib/theme-chalk/index.css'
import 'umy-ui/lib/theme-chalk/index.css'
import './assets/styles/index.scss'
if (process.env.NODE_ENV === "development") {
  localStorage.setItem("GATEWAY", 'http://192.168.1.72:8001/');
} else {
  switch (process.env.VUE_APP_ENV) {
    case 'ange':
      localStorage.setItem("GATEWAY", 'https://agsysapi.chetuotuo.net/');
      break;
    case 'mibang':
      localStorage.setItem("GATEWAY", 'https://mbsysapi.chetuotuo.net/');
      break;
    case 'xinyi':
      localStorage.setItem("GATEWAY", 'https://xysysapi.chetuotuo.net/');
      break;
    default:
      localStorage.setItem("GATEWAY", 'https://sysapi.chetuotuo.net/');
      break;
  }
}
Vue.use(dict)
Vue.use(Element)
Vue.use(elTableInfiniteScroll)
Vue.use(AFTableColumn)
Vue.use(UmyUi)
Vue.use(VueAxios)
Vue.use(Dialog)
Vue.prototype.hasPerm = hasBtnPermission
Vue.prototype.applocation = sysApplication
Vue.prototype.$eventBus = bus
Vue.config.productionTip = false

new Vue({
  router,
  store,
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
